package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppFeatureEngineeringMapper;
import com.ep.modules.app.entity.AppFeatureEngineering;
import com.ep.modules.app.entity.AppFeatureEngineeringExample;
import com.ep.modules.app.service.AppFeatureEngineeringService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppFeatureEngineeringServiceImpl implements AppFeatureEngineeringService {
    @Autowired
    private AppFeatureEngineeringMapper appFeatureEngineeringMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppFeatureEngineeringExample example = new AppFeatureEngineeringExample();
        AppFeatureEngineeringExample.Criteria criteria = example.createCriteria();
        List<AppFeatureEngineering> list = appFeatureEngineeringMapper.selectByExample(example);
        Page<AppFeatureEngineering> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppFeatureEngineering getById(Long id) {
        return appFeatureEngineeringMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppFeatureEngineering entity) {
        appFeatureEngineeringMapper.insert(entity);
    }

    public void update(AppFeatureEngineering entity) {
        appFeatureEngineeringMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appFeatureEngineeringMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}